from langchain_openai import ChatOpenAI
from globle import envs
from langchain_core.messages import HumanMessage, SystemMessage
from langchain_core.output_parsers import StrOutputParser

# 创建模型
model = ChatOpenAI(
    model="deepseek-chat",  # 或具体模型名
    base_url="https://api.deepseek.com/v1",  # DeepSeek API 地址
)

# 创建消息
messages = [
    SystemMessage(content="翻译英语到中文"),
    HumanMessage(content="hi!"),
]

# 创建解析器
parser = StrOutputParser()

# 创建链
chain = model | parser

# 调用链
r = chain.invoke(messages)
print(r)